package sv.gob.mh.dgii.model;

// Generated Dec 12, 2007 1:25:05 PM by Hibernate Tools 3.2.0.CR1

import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * CdPiezaDocum generated by hbm2java
 */
@Entity
@Table(name = "CD_PIEZA_DOCUM", schema = "CTROLDOC")
public class CdPiezaDocum implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1815942100797432869L;
	private CdPiezaDocumId id;
	private CdDocumento cdDocumento;
	private Long nfolioInicial;
	private Long nfolioFinal;
	private Date fhcrearPieza;
	private String cusuario;
	

	public CdPiezaDocum() {
	}

	public CdPiezaDocum(CdPiezaDocumId id, CdDocumento cdDocumento,
			Long nfolioInicial, Long nfolioFinal, Date fhcrearPieza) {
		this.id = id;
		this.cdDocumento = cdDocumento;
		this.nfolioInicial = nfolioInicial;
		this.nfolioFinal = nfolioFinal;
		this.fhcrearPieza = fhcrearPieza;
	}

	public CdPiezaDocum(CdPiezaDocumId id, CdDocumento cdDocumento,
			Long nfolioInicial, Long nfolioFinal, Date fhcrearPieza,
			String cusuario) {
		this.id = id;
		this.cdDocumento = cdDocumento;
		this.nfolioInicial = nfolioInicial;
		this.nfolioFinal = nfolioFinal;
		this.fhcrearPieza = fhcrearPieza;
		this.cusuario = cusuario;
	}

	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "ndocumento", column = @Column(name = "N_DOCUMENTO", nullable = false, length = 12)),
			@AttributeOverride(name = "npieza", column = @Column(name = "N_PIEZA", nullable = false, precision = 10, scale = 0)) })
	public CdPiezaDocumId getId() {
		return this.id;
	}

	public void setId(CdPiezaDocumId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "N_DOCUMENTO", nullable = false, insertable = false, updatable = false)
	public CdDocumento getCdDocumento() {
		return this.cdDocumento;
	}

	public void setCdDocumento(CdDocumento cdDocumento) {
		this.cdDocumento = cdDocumento;
	}

	@Column(name = "N_FOLIO_INICIAL", nullable = false, precision = 10, scale = 0)
	public Long getNfolioInicial() {
		return this.nfolioInicial;
	}

	public void setNfolioInicial(Long nfolioInicial) {
		this.nfolioInicial = nfolioInicial;
	}

	@Column(name = "N_FOLIO_FINAL", nullable = false, precision = 10, scale = 0)
	public Long getNfolioFinal() {
		return this.nfolioFinal;
	}

	public void setNfolioFinal(Long nfolioFinal) {
		this.nfolioFinal = nfolioFinal;
	}

	//@Temporal(TemporalType.DATE)
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "FH_CREAR_PIEZA", nullable = false, length = 7)
	public Date getFhcrearPieza() {
		return this.fhcrearPieza;
	}

	public void setFhcrearPieza(Date fhcrearPieza) {
		this.fhcrearPieza = fhcrearPieza;
	}

	@Column(name = "C_USUARIO", length = 30)
	public String getCusuario() {
		return this.cusuario;
	}

	public void setCusuario(String cusuario) {
		this.cusuario = cusuario;
	}

}
